﻿namespace MyFurion.Model
{
    /// <summary>
    /// 实体基类
    /// </summary>
    //[SugarIndex("index_{table}_id", nameof(Id), OrderByType.Asc, IsUnique = true)]
    //[SugarIndex("index_{table}_createdate", nameof(CreateTime), OrderByType.Asc)]
    //[SugarIndex("index_{table}_sort", nameof(SortNum), OrderByType.Asc)]
    //[SugarIndex("index_{table}_del", nameof(IsDeleted), OrderByType.Asc)]
    //[SugarIndex("index_{table}_orgid", nameof(CreateOrgId), OrderByType.Asc)]
    public class BaseEntity
    {
        /// <summary>
        /// 
        /// </summary>
        public BaseEntity()
        {
            CreateTime = DateTime.Now;
            IsDeleted = false;
            Id = SnowFlakeSingle.Instance.NextId();
        }
        /// <summary>
        /// id
        /// </summary>
        [SugarColumn(IsPrimaryKey =true, ColumnDescription = "主键")]
        public long Id { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true,ColumnDescription = "创建时间")]
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 创建人id
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true,IsNullable =true, ColumnDescription = "创建人id")]
        [Newtonsoft.Json.JsonIgnore]
        public string CreateUserId { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人")]
        [Newtonsoft.Json.JsonIgnore]
        public string CreateUser { get; set; }
        /// <summary>
        /// 创建单位id
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建单位id")]
        [Newtonsoft.Json.JsonIgnore]
        public string CreateOrgId { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert =true,IsNullable =true, ColumnDescription = "修改时间")]
        public DateTime? ModifyTime { get; set; }
        /// <summary>
        /// 修改人id
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, IsNullable = true, ColumnDescription = "修改人id")]
        [Newtonsoft.Json.JsonIgnore]
        public string ModifyUserId { get; set; }
        /// <summary>
        /// 修改人
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, IsNullable = true, ColumnDescription = "修改人")]
        [Newtonsoft.Json.JsonIgnore]
        public string ModifyUser { get; set; }
        /// <summary>
        /// 删除标识
        /// </summary>
        [SugarColumn(ColumnDescription ="删除标识")]
        [Newtonsoft.Json.JsonIgnore]
        public bool IsDeleted { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "删除时间",IsNullable =true)]
        [Newtonsoft.Json.JsonIgnore]
        public DateTime? DeleteTime { get; set; }
        /// <summary>
        /// 删除人id
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "删除人id", IsNullable = true)]
        [Newtonsoft.Json.JsonIgnore]
        public string DeleteUserId { get; set; }
        /// <summary>
        /// 删除人
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "删除人", IsNullable = true)]
        [Newtonsoft.Json.JsonIgnore]
        public string DeleteUser { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        [SugarColumn(ColumnDescription ="排序")]
        public int SortNum { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(ColumnDescription = "备注", IsNullable =true,ColumnDataType =CommonConst.DB_STRING_MAX)]
        public string Remark { get; set; }
        /// <summary>
        /// 多租户ID
        /// </summary>
        [SugarColumn(ColumnDescription = "多租户ID", DefaultValue = "0")]
        [Newtonsoft.Json.JsonIgnore]
        public long TenantId { get; set; }
    }
}